package com.lwl.blue.commont.config;

import com.lwl.blue.commont.filet.SessionInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>  </p>
 *
 * @Date: 2021/11/3 10:52
 * @version: V1.0
 * @Decription:
 * @author: 蓝文良
 */
@Configuration
public class SessionConfiguration extends WebMvcConfigurerAdapter {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        List<String> list = new ArrayList();
        list.add("/login");
        list.add("/loginPage");
        list.add("/static/**");
        list.add("/export/**");
        registry.addInterceptor(new SessionInterceptor())
                .addPathPatterns("/**").excludePathPatterns(list);
        //网站配置生成器：添加一个拦截器，拦截路径为整个项目
        super.addInterceptors(registry);
    }
}
